using Microsoft.SqlServer.Management.Sdk.Sfc;
using System;
using System.Globalization;
using System.IO;
using System.Text;

namespace Microsoft.SqlServer.Management.SqlManagerUI.Scripting
{
	internal class SingleScriptWriterProvider : TextWriterProvider
	{
		private StringBuilder scriptBuilder;

		public SingleScriptWriterProvider(StringBuilder scriptBuilder)
		{
			if (scriptBuilder == null)
			{
				throw new ArgumentNullException("scriptBuilder");
			}
			this.scriptBuilder = scriptBuilder;
		}

		public override TextWriter GetTextWriter(Urn item)
		{
			return new StringWriter(this.scriptBuilder, CultureInfo.CurrentCulture);
		}
	}
}
